import axios from "./axios";

//https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata

export const swiperdataApi=()=>{
    return axios({
        method:'GET',
        url:'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
    })
}
//https://api-hmugo-web.itheima.net/api/public/v1/home/catitems

export const catitemsApi=()=>{
    return axios({
        method:'GET',
        url:'https://api-hmugo-web.itheima.net/api/public/v1/home/catitems',
    })
}
//https://api-hmugo-web.itheima.net/api/public/v1/home/floordata

export const floordataApi=()=>{
    return axios({
        method:'GET',
        url:'https://api-hmugo-web.itheima.net/api/public/v1/home/floordata',
    })
}

//https://api-hmugo-web.itheima.net/api/public/v1/goods/qsearch

export const qsearchApi=(query)=>{
    return axios({
        method:'GET',
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/qsearch',
        params:{
            query
        }
    })
}

//https://api-hmugo-web.itheima.net/api/public/v1/goods/detail

export const detailApi=(goods_id)=>{
    return axios({
        method:'GET',
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/detail',
        params:{
            goods_id
        }
    })
}
//https://api-hmugo-web.itheima.net/api/public/v1/categories

export const categoriesApi=()=>{
    return axios({
        method:'GET',
        url:'https://api-hmugo-web.itheima.net/api/public/v1/categories',
    })
}
//https://api-hmugo-web.itheima.net/api/public/v1/goods/search

export const searchApi=(query)=>{
    return axios({
        method:'GET',
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/search',
        params:{
            query
        }
    })
}

//http://localhost:12345/api/user/register

export const registerApi=(username,password)=>{
    return axios({
        method:'POST',
        url:'http://localhost:12345/api/user/register',
        data:{
            username,password
        }
    })
}

export const loginApi=(username,password)=>{
    return axios({
        method:'POST',
        url:'http://localhost:12345/api/user/login',
        data:{
            username,password
        }
    })
}
///api/order/create

export const createApi=(data)=>{
    return axios({
        method:'POST',
        url:'http://localhost:12345/api/order/create',
        data:{
            ...data
        }
    })
}

///api/order/getOrder/ak0jbjczik
export const getOrderApi=(orderId)=>{
    return axios({
        method:'GET',
        url:'http://localhost:12345/api/order/getOrder/'+orderId,
        data:{
           orderId
        }
    })
}
///api/order/pay
export const payApi=(data)=>{
    return axios({
        method:'POST',
        url:'http://localhost:12345/api/order/pay',
        data:{
            ...data
        }
    })
}

///api/order/getOrderList/zhangsan

export const getOrderListApi=(username)=>{
    return axios({
        method:'GET',
        url:'http://localhost:12345/api/order/getOrderList/'+username,
        params:{
            username
        }
    })
}